home *** CD-ROM | disk | FTP | other *** search
- -----------------------
- -- TEMPORARY!
- -----------------------
-
-
-
- -- This is the sequence where the Basic is introduced
- function BasicCinematic()
-
- -- Look at tower, traitor keeps talking, then (Oh no!)
- -- basic invaders appear (around the tower?) and call
- -- out to traitor/hand
- local tower = G.GetCogName("Tower");
- local towerPos = tower.GetPosition();
- Camera.CinemaLookAt( tower );
-
- -- Rotate around while looking at the tower
- TraitorTalk("Hi! Welcome to Base Invaders! My name is 'Traitor'.");
-
- Camera.CinemaMove( towerPos + Vector3(-40,65,-40), towerPos, 3 );
- GameWait(3)
-
- Camera.CinemaRotate( -3.14 * 1.5 / 9.0 ) -- Rotate 3/4 around the tower in 9 seconds
- GameWait(3)
-
- -- Spawn cinema basic(s)
- local CinemaInvader = G.CreateAt( "Basic", towerPos + Vector3( -40, 0, 40 ) );
- CinemaInvader.TurnOffAI()
-
- TraitorTalk("The tower sure is looking great today!");
- GameWait(6)
- Camera.CinemaRotate( 0 )
-
- -- Look at cinema basic
- local invPos = CinemaInvader.GetPosition()
- Camera.CinemaMove( towerPos + Vector3(40,65,-25), invPos, 0.5 );
- Camera.CinemaLookAt( CinemaInvader );
-
- -- 3. Speech
- local CinemaInvader2 = G.CreateAt( "Basic", towerPos + Vector3( 5, 0, 40 ) );
- CinemaInvader2.TurnOffAI()
-
- G.SayPhraseScript( "Traitor! You\n have allied\n with the hand!", CinemaInvader );
- GameWait(3)
-
- local CinemaInvader3 = G.CreateAt( "Basic", towerPos + Vector3( -40, 0, 5 ) );
- CinemaInvader3.TurnOffAI()
-
- TraitorTalk( "Oh no, the invaders, they've found me!" );
- GameWait(3)
-
-
- CinemaInvader.Hop( 20 )
- G.SayPhraseScript( "We will destroy\n the tower and\n you with it!" , CinemaInvader );
- GameWait(2)
-
- G.SayPhraseScript( "Yeah!" , CinemaInvader2 );
- CinemaInvader2.Hop(20)
-
- invPos = CinemaInvader2.GetPosition()
- Camera.CinemaMove( towerPos + Vector3(40,65,-40), invPos, 0.5 );
- Camera.CinemaLookAt( CinemaInvader2 );
-
- GameWait(2)
-
- G.SayPhraseScript( "It's going\n down!" , CinemaInvader3 );
-
- invPos = CinemaInvader3.GetPosition()
- Camera.CinemaMove( towerPos + Vector3(40,65,-40), invPos, 0.5 );
- Camera.CinemaLookAt( CinemaInvader3 );
-
- CinemaInvader3.Hop( 20 )
-
- TraitorTalk( "Quickly! Eliminate them before they destroy the base!" );
- GameWait(5)
-
- Camera.EndCinemaLookAt();
- CinemaInvader.TurnOnAI()
- CinemaInvader2.TurnOnAI()
- CinemaInvader3.TurnOnAI()
-
- -- 4. End (Revert to tower?)
-
- end
-
-
- -- This is the sequence where the Miner is introduced
- function MinerCinematic()
-
- TraitorTalk( "Wait, What's that?" );
-
- local tower = G.GetCogName("Tower");
- local towerPos = tower.GetPosition();
-
- -- 1. Spawn cinema miner
- TrapPlace( "wall", Vector3(126,0,130), Vector3(1,0,0));
- TrapPlace( "wall", Vector3(130,0,126), Vector3(1,0,0));
-
- TrapPlace( "wall", Vector3(142,0,142), Vector3(1,0,0));
- TrapPlace( "wall", Vector3(130,0,130), Vector3(1,0,0));
- TrapPlace( "wall", Vector3(150,0,150), Vector3(1,0,0));
- TrapPlace( "wall", Vector3(134,0,142), Vector3(1,0,0));
- TrapPlace( "wall", Vector3(142,0,134), Vector3(1,0,0));
- TrapPlace( "wall", Vector3(138,0,132), Vector3(1,0,0));
- TrapPlace( "wall", Vector3(126,0,120), Vector3(1,0,0));
- TrapPlace( "wall", Vector3(120,0,130), Vector3(1,0,0));
- TrapPlace( "wall", Vector3(146,0,150), Vector3(1,0,0));
-
- local CinemaInvader = G.CreateAt( "Miner", Vector3( 115, 0, 125 ) );
- local CinemaInvader2 = G.CreateAt( "Miner", Vector3( 120, 0, 120 ) );
- local CinemaInvader3 = G.CreateAt( "Miner", Vector3( 125, 0, 115 ) );
-
- -- 2. Look at cinema basic
- Camera.CinemaMove( Vector3(170,25,170), Vector3(126,0,130), 2 );
- -- Camera.CinemaLookAt( CinemaInvader );
- GameWait(2)
-
- G.SayPhraseScript( "Who Put all\n these walls\n here!?!" , CinemaInvader );
- -- 3. Have him attack several walls
- GameWait(2)
-
- TraitorTalk( "Oh no! Miners! They'll make short work of our defenses!" );
- GameWait(3)
- G.EndCurrentPhrase( CinemaInvader )
-
- G.SayPhraseScript( "ARRGH! \nMore walls!" , CinemaInvader3 );
- GameWait(2)
- G.EndCurrentPhrase( CinemaInvader3 )
-
- G.SayPhraseScript( "I Hate \nthese Walls!" , CinemaInvader2 );
-
- TraitorTalk( "They sound ticked off, better get rid of them quickly!" );
- GameWait(2)
- G.EndCurrentPhrase( CinemaInvader2 )
-
- G.SayPhraseScript( "DIE you \ndarn Walls!" , CinemaInvader3 );
- GameWait(3)
- G.EndCurrentPhrase( CinemaInvader3 )
-
- Camera.EndCinemaLookAt();
- -- 4. End (Revert to tower?)
-
- end
-
- -- Create ~3 spikers, kill them with traps
- function SpikerCinematic()
-
- local tower = G.GetCogName("Tower");
- local towerPos = tower.GetPosition();
-
- TrapPlace( "hammer", towerPos + Vector3(80,0, 20), Vector3(0,0,-1));
- TrapPlace( "hammer", towerPos + Vector3(54,0,-40), Vector3(0,0,1));
- TrapPlace( "hammer", towerPos + Vector3(70,0,-20), Vector3(0,0,1));
-
- TrapPlace( "fan", towerPos + Vector3(50,0, 10), Vector3(0,0,-1));
-
-
- local CinemaInvader = G.CreateAt( "Spiker", towerPos + Vector3( 130, 0, 0 ) );
- local CinemaInvader2 = G.CreateAt( "Spiker", towerPos + Vector3( 130, 0, 20 ) );
- local CinemaInvader3 = G.CreateAt( "Spiker", towerPos + Vector3( 130, 0, -20 ) );
-
- Camera.CinemaMove( towerPos + Vector3( 5, 60, 0 ), towerPos + Vector3( 100,0,0 ), 2 );
- Camera.CinemaLookAt( CinemaInvader );
- GameWait(2)
-
- -- Spiker appears:
- G.SayPhraseScript( "Rock on!" , CinemaInvader );
- G.SayPhraseScript( "Hardcore!", CinemaInvader2 );
- G.SayPhraseScript( "Punk'd!" , CinemaInvader3 );
-
- TraitorTalk( "Spikers! They're tough, and You can't grab them. " );
- GameWait(3)
-
- G.SayPhraseScript( "Can't Touch\n this!" , CinemaInvader );
-
- TraitorTalk( "But like most invaders they aren't very bright. " );
- GameWait(4)
-
- TraitorTalk( "Traps will get rid of them easily. " );
- GameWait(5)
-
- end
-
-
-
-
- CreditsText = {}
- CreditsText[0] = "Basic Invaders"
- CreditsText[1] = "Credits"
- CreditsText[2] = "Programming By"
- CreditsText[3] = "Matt Miner"
- CreditsTextLength = 4
- CreditsInvaders = {}
-
-
- -- Each invader walks past the camera (on it way to the tower)
- function CreditsCinematic()
-
- Camera.CinemaMove( Vector3(170,15,170), Vector3(126,0,130), 2 );
-
- -- Each invader passes by, while saying their text
- local curText = 0
- while( curText < CreditsTextLength ) do
-
- -- Create the invader
- local CinemaInvader = G.CreateAt( "Basic", Vector3( 125, 0, 130 ) );
-
- GameWait(3)
- curText = curText + 1;
- end
-
- end
-
-
-
-
- --Common Level Start Code
- function LevelStartup()
-
- G.Create( "MenuData/HudCog.xml" );
- G.Create( "Data/GameCamera.xml" );
- G.Create( "Data/CursorCog.xml" );
-
- MainLevel = G.Create( "Data/Levels/Campaign1.xml" );
- MainLevel.CreateLevel();
-
- G.SetInvSpeed( 20 );
- HUD.EnterLevel();
- G.SetGameState( InLevel );
- G.EarnPoints( 100 );
- G.SetMaxKills(0);
-
- G.SetLightTime( 5 );
- G.PostP( "None" );
-
- HUD.Message( "VictoryCondition" , "SetText", "Survive 3 Invasion Waves!" );
- HUD.Message( "LossCondition" , "SetText", "If the Tower falls you lose." );
-
- TraitorCanBeHidden = true
- ----TraitorTalk(" ");
- end
-
- LevelStartup()
-
-
- function LevelIntro()
-
- local tempPos = Tower.GetPosition()
- Camera.LookAtPosition( tempPos )
-
- -- There is no intro for this level:
- gameStartTime = GameTime;
- ColorTextPopup( "Level 1: Traitor's Trouble", Color(1,1,1,1) )
-
- G.DisableTrapAll()
-
- DisableTraitor()
- GameWait(1.5)
-
- StartCinematic();
-
- BasicCinematic();
- --MinerCinematic();
-
- EndCinematic();
-
-
-
- --TraitorTalk("Yeah that's right I am Tat");
- --TraitorTalk("Hi! Welcome to base invaders! My name is 'Traitor'. Say, Thats a real nice tower you've got there.");
- --GameWait(8)
- --TraitorTalk("However, my invader brothers are Bataphobic. That is, they're afraid of tall buildings.");
- --GameWait(8)
- --TraitorTalk("Me? Don't be silly, I'm not scared of your goofy tower.");
- --GameWait(5)
- --TraitorTalk("In fact, I'm gonna live in here and help you!");
- --GameWait(4)
- --TraitorTalk("My generosity comes with a price, though.");
- --GameWait(4)
- --TraitorTalk("You'll have to protect me against the other invaders.");
- --GameWait(5)
- --TraitorTalk("They're not too happy with me helping the owner of that tall, tall tower.");
- --GameWait(7)
- --TraitorTalk("They'll be coming soon to *gulp* hurt me!");
- --GameWait(4)
- end
-
- function LevelSequence()
-
- -- 1st Have a tower and some walls and let the Basic guys attack.
- Traitor.SetGuiPosition( "TraitorWindow" , Vector3(0.6, -0.5, 1) );
-
- -- Start Spawning thr guys
- BasicWave = createSpawnStruct()
-
- BasicWave.Prob.Basic = 1.0;
-
- BasicWave.SpawnSpeed = 0.3;
- BasicWave.MaxSpawn = 3;
- BasicWave.TotalSpawn = 7;
- BasicWave.GroupPercent = 0.5;
- BasicWave.GroupSize = 3;
- BasicWave.WhereToSpawn = SmallCircleAroundTower
-
- G.SetInvSpeed( 10 ); -- Slow the first waves
-
- InvaderTextPopup( "Basic" );
- AddWave( "BasicAttack", BasicWave );
- G.SetMaxKills(10);
-
- TraitorTalk("Look out! Here they come!")
- GameWait(4)
- TraitorTalk("Get rid of them by throwing them with your hand.")
- InvadersKilledWait(8)
-
- TraitorTalk( "I think they're letting up!" )
- GameWait(3)
- InvadersKilledWait( 10 ) --WaitForClearEnemies() -- This doesn't actually wait for all 20enemies to have been killed
- StopWave( "BasicAttack" );
-
- TraitorTalk( "They're gone! But we should reinforce the base in case more come!" )
- GameWait(8)
-
- TrapTextPopup("Walls")
- G.EarnPoints( 50 )
- G.EnableTrap("wall");
- TraitorTalk( "Try dropping some walls to fortify our defenses!" )
- GameWait(7)
-
- TraitorTalk( "You can drag out a line of walls, by holding the mouse button!" )
- GameWait(7)
-
- GameWaitOrMoney(20) -- This should have a countdown!
-
- StartCinematic();
- MinerCinematic();
- EndCinematic();
-
- BasicWave.Prob.Basic = 0.0;
- BasicWave.Prob.Miner = 1.0;
- BasicWave.TotalSpawn = 17;
-
- InvaderTextPopup( "Miner" );
-
- G.SetInvSpeed( 15 ); -- Slightly faster for the Miners
-
- -- TraitorTalk("Look out here comes some Miners!")
- -- GameWait(3)
- -- TraitorTalk("They're ticked off, and will attack anything they see!")
- -- GameWait(6)
- AddWave( "MinerAttack", BasicWave );
- G.SetMaxKills(30);
- TraitorTalk("Throw them with the hand before they reach the tower!")
- InvadersKilledWait(25)
-
- TraitorTalk( "Not that many Miners Left!" )
- GameWait(3)
- InvadersKilledWait( 30 ) --WaitForClearEnemies()
- StopWave( "MinerAttack" );
-
- TraitorTalk( "That was tough! We need to get some better defenses here!" )
- GameWait(6)
-
- TrapTextPopup("Fans")
- G.EarnPoints( 50 )
- G.EnableTrap("fan");
- TraitorTalk( "Here are the blueprints for a Fan Trap. Use fans to blow invaders around, even into other traps!" )
- G.EarnPoints( 25 )
- GameWait(10)
-
- TrapTextPopup("Hammers")
- G.EarnPoints( 50 )
- G.EnableTrap("hammer");
-
- TraitorTalk( "Here are the blueprints for a Hammer Trap, too. They will smash invaders flat!" )
- G.EarnPoints( 25 )
- GameWait(10)
-
- TraitorTalk( "Place some traps around the base.");
- GameWait(10)
-
- StartCinematic();
- SpikerCinematic();
- EndCinematic();
-
- InvaderTextPopup( "Spiker" );
-
- TraitorTalk( "Hurry up and finish those defenses. I think I see more coming!");
- GameWaitOrMoney(25)
-
- TraitorTalk("Look out here come some more Spikers!")
- GameWait(5)
- -- TraitorTalk("Their spiked helmets prevent you from grabbing them!")
- -- GameWait(6)
-
- G.SetInvSpeed( 20 ); -- Normal speed for the spikers
-
- BasicWave.Prob.Basic = 1.0;
- BasicWave.Prob.Miner = 1.0;
- BasicWave.Prob.Spiker = 2.0;
- BasicWave.TotalSpawn = 32;
-
- AddWave( "SpikerAttack", BasicWave );
- G.SetMaxKills(65);
-
- TraitorTalk("Smash those Spikers with hammers or drop a trap on them!")
- InvadersKilledWait(60)
-
- TraitorTalk( "Just a few more!" )
- GameWait(3)
- InvadersKilledWait( 65 ) --WaitForClearEnemies()
- StopWave( "SpikerAttack" );
-
- TraitorTalk( "Wow you survived! But this is just one Day!" )
- GameWait(4)
-
- G.SetGameState( Victory );
-
- TraitorTalk( "Those invaders will be back, but don't worry, I'll have some new tricks in store for them tomorrow!" )
- GameWait(5)
-
-
- end
-
- levelRoutine = coroutine.create(LevelIntro);
-
- GMain["LevelUpdate"] = LevelUpdate;
-
-
-